package cn.aicnn.chatssespringboot.controller;

import cn.aicnn.chatssespringboot.dto.OOMAnalysisRequestDTO;
import cn.aicnn.chatssespringboot.dto.OOMAnalysisResponseDTO;
import cn.aicnn.chatssespringboot.service.OOMAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/oom-analysis")
public class OOMAnalysisController {

    private final OOMAnalysisService oomAnalysisService;

    @Autowired
    public OOMAnalysisController(OOMAnalysisService oomAnalysisService) {
        this.oomAnalysisService = oomAnalysisService;
    }

    @PostMapping("/upload")
    public ResponseEntity<OOMAnalysisResponseDTO> analyzeOOMFile(
            @RequestParam("file") MultipartFile file) {
        OOMAnalysisResponseDTO response = oomAnalysisService.analyzeOOMFile(file);
        return ResponseEntity.ok(response);
    }
}